module_init_template = '/* -*- Mode: C; c-basic-offset: 4 -*- */\n' + '#ifdef HAVE_CONFIG_H\n' + '# include "config.h"\n' + '#endif\n' + '#include <Python.h>\n' + '#include <pygtk.h>\n' + '\n' + '/* include any extra headers needed here */\n' + '\n' + 'void %(prefix)s_register_classes(PyObject *d);\n' + 'extern PyMethodDef %(prefix)s_functions[];\n' + '\n' + 'DL_EXPORT(void)\n' + 'init%(module)s(void)\n' + '{\n' + ' PyObject *m, *d;\n' + '\n' + ' /* perform any initialisation required by the library here */\n' + '\n' + ' m = Py_InitModule("%(module)s", %(prefix)s_functions);\n' + ' d = PyModule_GetDict(m);\n' + '\n' + ' init_pygtk();\n' + '\n' + ' %(prefix)s_register_classes(d);\n' + '\n' + ' /* add anything else to the module dictionary (such as constants) */\n' + '\n' + ' if (PyErr_Occurred())\n' + ' Py_FatalError("could not initialise module %(module)s");\n' + '}\n'
override_template = '/* -*- Mode: C; c-basic-offset: 4 -*- */\n' + '%%%%\n' + 'headers\n' + '/* include any required headers here */\n' + '%%%%\n' + 'init\n' + ' /* include any code here that needs to be executed before the\n' + ' * extension classes get initialised */\n' + '%%%%\n' + '\n' + '/* you should add appropriate ignore, ignore-glob and\n' + ' * override sections here */\n'